<?php

class ChangePwdMember extends MY_Controller {

    public function __construct() {
        parent::__construct();
    }

    function index() {
        $this->initForm();
        $this->data['editMode'] = false;
        $memberId = $this->session->userdata('memberID');
        $this->load->model("Member_Model");
        $this->data['data_member'] = $this->Member_Model->getMemberByID($memberId);

        $this->data['main_content'] = 'change_pwd_member';
        $this->load->view('includes/template', $this->data);
    }

    function initForm() {
        $member = array(
            'oldPassword' => '',
            'newPassword' => '',
            'confNewPassword' => '',
        );
        $this->data['member'] = $member;
    }

    function changePwd() {
        $member = array(
            'PASSWORD' => MD5($this->input->post('newPassword'))
        );
        $this->load->model("Member_Model");
        $this->Member_Model->updateMember($member,null);
        $this->data['main_content'] = 'change_pwd_member';
        $this->load->view('includes/template', $this->data);
    }

}

?>
